<?php
/**
 * Created by PhpStorm.
 * User: songs
 * Date: 2019/8/23
 * Time: 10:04
 */

namespace App\admin\TableView;


use App\admin\TableView\BaseClass\BaseViewList;
use App\Models\Admin\AdminModel;

class AdminViewList extends BaseViewList
{

    public function get_model()
    {

        return new AdminModel();
    }

    public $topTitle = '用户';
    public $PageSize =10;

    public $breadcrumb = '<li><a href="/admin">Home</a></li>
        <li><a href="javascript:;">用户</a></li>
        <li class="active">后台用户</li>';

    public $html = '';


  //  public $show_add = false; ///显示添加按钮

    /**
     * 获取表格的唯一名字
     */
    public function getName()
    {
        return 'AdminModel';
    }

    /**
     * 需要继承,然后定义每行需要显示的数据格式
     */
    public function Labels()
    {
        return array(
            'id' => array('style' => 'width:50px'),
            'id' => '',
            'name' => '',
            'del' => '',
            'control' => [
                'edit',
                'delete'
            ]
        );
    }

    /**
     * 方便继承,多一层过滤
     */
    public function ModelTohtml($key, $model)
    {
        return $model->$key;
    }


    /**
     * 顶部的选择区,参数,如果为空,则不显示选择器
     */
    public function getselectAttr()
    {

        ///例子
        $where = [

        ];
        return $where;
    }

    /**
     * 返回查询的条件
     *
     * public function find() {
     * $find =DB::table('customers')->where(
     * 'deleted_at','!=',null
     *
     * );
     *
     * if (isset($_GET['submit']) && $_GET['submit'] == 'true') {
     * $this->andWhere($find);
     * }
     *
     * $find->orderBy($this->get_primaryKey(),'DESC');
     * return $find;
     * }
     */

    /**
     * 对话框中的各个字段
     */
    public function dialog()
    {

        return array(
            array(
                'title' => '昵称',
                'zd' => 'name'
            ),

        );
    }

}